From: Anton Gladky Date: Tue, 13 Oct 2026 10:08:50 +0000 (+0200) Subject: Fix path for the installation of python modules X-Git-Tag: archive/raspbian/9.6.2+ds-3+rpi1^2~23 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=08c435858c865d1085d8a2b0c7d4ea2fcedb1764;p=vtk9.git Fix path for the installation of python modules Last-Update: 2020-11-06 Gbp-Pq: Name 50_fix_python-modules_path.patch --- diff --git a/CMake/vtkModuleWrapPython.cmake b/CMake/vtkModuleWrapPython.cmake index b0707df60..865c75c59 100644 --- a/CMake/vtkModuleWrapPython.cmake +++ b/CMake/vtkModuleWrapPython.cmake @@ -82,7 +82,7 @@ function (vtk_module_python_default_destination var) "for Python modules.") set(_vtk_python_version_suffix) endif () - set(destination "${CMAKE_INSTALL_LIBDIR}/python${_vtk_python_version_suffix}/site-packages") + set(destination "lib/python3/dist-packages") endif () set("${var}" "${destination}" PARENT_SCOPE) diff --git a/Utilities/Python/CMakeLists.txt b/Utilities/Python/CMakeLists.txt index f7ae2a77b..96bf7bd98 100644 --- a/Utilities/Python/CMakeLists.txt +++ b/Utilities/Python/CMakeLists.txt @@ -54,7 +54,7 @@ if (NOT VTK_PYTHON_SITE_PACKAGES_SUFFIX) set(VTK_PYTHON_SITE_PACKAGES_SUFFIX "Lib/site-packages") else () set(VTK_PYTHON_SITE_PACKAGES_SUFFIX - "python${vtk_python_version_pair}/site-packages") + "python3/dist-packages") endif () endif () diff --git a/Wrapping/Python/vtkmodules/__init__.py.in b/Wrapping/Python/vtkmodules/__init__.py.in index 3730dc01a..7fbcb93d9 100644 --- a/Wrapping/Python/vtkmodules/__init__.py.in +++ b/Wrapping/Python/vtkmodules/__init__.py.in @@ -8,21 +8,20 @@ import importlib.util from pathlib import Path from importlib.abc import MetaPathFinder -from importlib.machinery import ExtensionFileLoader +from importlib.machinery import ExtensionFileLoader, EXTENSION_SUFFIXES LOADING_STACK = [] -LIB_EXTS = [".pyd", ".so"] + def find_lib_path(paths, vtk_module_name): - for ext in LIB_EXTS: + for ext in EXTENSION_SUFFIXES: for base_path in paths: # vtk-wheel => vtkCommonCore.cpython-310-darwin.so # paraview => vtkCommonCore.so # Caution: vtkIOXML vs vtkIOXMLParser - for f in Path(base_path).glob(f"{vtk_module_name}[.-]*"): - resolved_file = f.resolve() - if resolved_file.is_file() and ext in resolved_file.suffixes: - return str(resolved_file) + f = Path(base_path) / f"{vtk_module_name}{ext}" + if f.is_file(): + return str(f.resolve()) class VTKMetaHook(MetaPathFinder):